#include <bits/stdc++.h>
using namespace std;
int n,maxn,dep,res,ans;
int r[100005],sum[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        sum[r[i]]++;
        if(r[i]>maxn) maxn=r[i];
    }
    for(int i=1;i<=maxn;i++){
        if(sum[i]){
            sum[++dep]=sum[i];
        }
    }
    res=sum[1];
    for(int i=2;i<=dep;i++){
        ans+=min(res,sum[i]);
        if(res<sum[i]) res=sum[i];
    }
    cout<<n-ans<<endl;
    return 0;
}